package com.pz.cloud.framework.workflow.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pz.cloud.framework.business.workflow.entity.TaskNodeHandlerRule;
import com.pz.cloud.framework.business.workflow.service.ITaskNodeHandlerRuleService;
import com.pz.cloud.framework.workflow.mapper.TaskNodeHandlerRuleMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Transactional(rollbackFor = Exception.class)
@Service
public class TaskNodeHandlerRuleServiceImpl extends ServiceImpl<TaskNodeHandlerRuleMapper, TaskNodeHandlerRule> implements ITaskNodeHandlerRuleService {

    @Override
    public List<TaskNodeHandlerRule> findByTaskKey(String taskKey) {
        LambdaQueryWrapper<TaskNodeHandlerRule> query = new LambdaQueryWrapper<>();
        query.eq(TaskNodeHandlerRule::getTaskKey,taskKey);
        List<TaskNodeHandlerRule> list = this.list(query);
        return list;
    }
    @Override
    public void deleteByTaskKey(String taskKey) {
        LambdaQueryWrapper<TaskNodeHandlerRule> query = new LambdaQueryWrapper<>();
        query.eq(TaskNodeHandlerRule::getTaskKey,taskKey);
        boolean remove = this.remove(query);
    }
}
